package com.ukao.pad.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.mcxtzhang.commonadapter.rv.CommonAdapter;
import com.mcxtzhang.commonadapter.rv.ViewHolder;
import com.ukao.pad.R;
import com.ukao.pad.bean.AddClothingItem;
import com.ukao.pad.utils.CheckUtils;

import java.util.List;

/**
 * Created by ukaodev on 2017/6/14.
 */

public class AddClothingAdapter extends CommonAdapter<AddClothingItem> {

private  boolean isSearchEnter;

    public AddClothingAdapter(Context context, List<AddClothingItem> datas, int layoutId) {
        super(context, datas, layoutId);

    }

    public void  setIsSearchEnter(boolean isSearchEnter ){
            this.isSearchEnter=isSearchEnter;
    }

    @Override
    public void convert(ViewHolder holder, AddClothingItem item) {

        TextView mTextView=holder.<TextView>getView(R.id.activity_addclothing_list_item_tv);
        mTextView.setText(item.getName());

        if (!isSearchEnter){
            ImageView hook=holder.<ImageView>getView(R.id.hook);
            if (item.isCheck()){

                if (!CheckUtils.isNull(hook)){hook.setVisibility(View.VISIBLE);}
                mTextView.setBackgroundResource(R.drawable.shape_factory_blue);

            }else{
                mTextView.setBackgroundResource(R.drawable.shape_clothing_black);
                if (!CheckUtils.isNull(hook)){hook.setVisibility(View.GONE);}
            }
        }else{
            if (item.isCheck()){
                mTextView.setBackgroundColor(mContext.getResources().getColor(R.color.blue));

            }else{
                mTextView.setBackgroundColor(mContext.getResources().getColor(R.color.transparent));

            }
        }






    }








}
